package com.hd.crdao.activity;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.hd.crdao.R;
import com.hd.crdao.base.BaseActivity;
import com.hd.crdao.utils.SPUtils;
import com.hd.crdao.utils.UIUtils;
import com.hd.crdao.view.ExpandHeadView;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 *
 *@author Administrator
 *@date 2017/8/9 0009
 */

public class PaySuccessActivity extends BaseActivity {
    @BindView(R.id.head_pay_success)
    ExpandHeadView mHeadPaySuccess;
    @BindView(R.id.price)
    TextView mPrice;
    @BindView(R.id.paytype)
    TextView mPaytype;
    @BindView(R.id.plorder)
    TextView mPlorder;
    @BindView(R.id.datatime)
    TextView mDatatime;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_paysuccess;
    }

    @Override
    protected void initView() {
        ButterKnife.bind(this);
    }

    @Override
    protected void initData() {
        String domainPrice = getIntent().getStringExtra("domainPrice");
        String payType = getIntent().getStringExtra("payType");

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss", Locale.CHINESE);
        String format = formatter.format(new Date(System.currentTimeMillis()));

        mPrice.setText(String.format("￥%s", domainPrice));
        mPaytype.setText(payType);
        mDatatime.setText(format);
        SPUtils.saveString("domainPayinfo", "");
    }

    @Override
    protected void initListener() {
        mHeadPaySuccess.getLeftArrowLL().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(UIUtils.getContext(), MyShopActivity.class));
                finish();
            }
        });
    }

}